package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 加班申请
 * </p>
 *
 * @author dqq
 * @date 2023-03-07
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "WorkOvertimeWorkOvertimeTypeEnum", description = "加班类型 #{WORK_OVERTIME_TYPE:加班类型;ADVANCE_APPROACH:提前入场申请;LOAD_UPLOAD_SERVICE:装卸服务申请-枚举")
public enum WorkOvertimeWorkOvertimeTypeEnum implements BaseEnum {

    /**
     * WORK_OVERTIME_TYPE="加班类型"
     */
    WORK_OVERTIME_TYPE("加班类型"),
    /**
     * ADVANCE_APPROACH="提前入场申请"
     */
    ADVANCE_APPROACH("提前入场申请"),
    /**
     * LOAD_UPLOAD_SERVICE="装卸服务申请"
     */
    LOAD_UPLOAD_SERVICE("装卸服务申请"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static WorkOvertimeWorkOvertimeTypeEnum match(String val, WorkOvertimeWorkOvertimeTypeEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static WorkOvertimeWorkOvertimeTypeEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(WorkOvertimeWorkOvertimeTypeEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "WORK_OVERTIME_TYPE,ADVANCE_APPROACH,LOAD_UPLOAD_SERVICE", example = "WORK_OVERTIME_TYPE")
    public String getCode() {
        return this.name();
    }

}
